package com.spring.cloud.practice.demo.springbootrabbitmq.producer;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * <b><code>Sender</code></b>
 * <p/>
 * Description
 * <p/>
 * <b>Creation Time:</b> 2019/8/6 19:33.
 *
 * @author huanghuayan
 * @since spring-cloud-demo
 */
@Component
public class Sender {

    @Autowired
    RabbitTemplate rabbitTemplate;

    public void send() {
        String message = "message: " + new Date();
        System.out.println("Sender:" + message);
        rabbitTemplate.convertAndSend("immediate_exchange_test1", "immediate_routing_key_test1", message);
    }
}
